<template>
  <div>
    <el-card class="mb">
      <el-table border :data="skuList">
        <el-table-column
          label="序号"
          width="80px"
          align="center"
          type="index"
        />
        <el-table-column label="名称" type="info" prop="skuName" />
        <el-table-column label="描述" prop="skuDesc" />
        <el-table-column label="默认图片" prop="skuDefaultImg" />
        <el-table-column label="重量(KG)" prop="weight" />
        <el-table-column label="价格(元)" prop="price" />
        <el-table-column label="操作" width="280px" align="center">
          <el-button type="info" icon="el-icon-top" size="small" />
          <el-button type="primary" icon="el-icon-edit-outline" size="small" />
          <el-button type="info" icon="el-icon-info" size="small" />
          <el-button type="danger" icon="el-icon-delete" size="small" />
        </el-table-column>
      </el-table>
    </el-card>
    <el-pagination
      :current-page="currentPage"
      :page-sizes="[3, 6, 9, 12]"
      :page-size="pageSize"
      layout="prev, pager, next, jumper, ->, total, sizes"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
import { reqSkuList } from '@/api/product/attrList'
export default {
  name: 'Sku',
  data() {
    return {
      currentPage: 1,
      pageSize: 3,
      total: 0,
      skuList: []
      // trademarkList: [],
    }
  },

  mounted() {
    this.getSkuList()
  },

  methods: {
    // async getSkuList() {
    //   const res = await reqSkuList(this.currentPage, this.pageSize)
    //   console.log(res)
    //   this.skuList = res.data.records
    //   // this.currentPage = res.data.current
    //   // this.pageSize = res.data.pages
    //   this.total = res.data.total
    // }

    async getSkuList() {
      // console.log(this.pageSize, 'pageSize')
      const res = await reqSkuList(this.currentPage, this.pageSize)
      console.log(res)
      this.trademarkList = res.data.records
      this.pageSize = res.data.size
      this.currentPage = res.data.current
      this.total = res.data.total
    }
  }
}
</script>

<style lang="less" scoped></style>
